<template>
  <svg :style="{ width: props.size, height: props.size }" class="svg">
    <use :xlink:href="prefix + name" :fill="color"></use>
  </svg>
</template>

<script setup lang="ts">
const props = defineProps({
  //xlink:href属性值的前缀
  prefix: {
    type: String,
    default: '#icon-'
  },
  //svg矢量图的名字
  name: String,
  //svg图标的颜色
  color: {
    type: String,
    default: ''
  },

  //svg高度
  size: {
    type: String,
    default: '16px'
  }
})
</script>
<style scoped lang="scss">
.svg {
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>
